package com.dj.ms.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * <br>
 * <p></p>
 *
 * <br>
 *
 * @author ZJG
 * @version 1.0
 * @date 2021/9/27 下午2:39
 */
@Getter
public enum LogScopeEnum {

    ALL(0), REQUEST(1), RESPONSE(2);

    private final int value;

    LogScopeEnum(int value) {
        this.value = value;
    }


    public static LogScopeEnum typeOf(String name) {
        if (StringUtils.isBlank(name)) {
            return LogScopeEnum.ALL;
        }
        for (LogScopeEnum d: LogScopeEnum.values()) {
            if (StringUtils.equals(name, d.name())) {
                return d;
            }
        }
        return LogScopeEnum.ALL;
    }
}
